/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

/**
 *
 * @author anh
 */
public class ImageBackgroundPanel extends JPanel{
    private ImageIcon bgImage;
  
        public ImageBackgroundPanel(ImageIcon bgImage) {
            this.bgImage = bgImage;
        }
  
        @Override
        public void paintComponent(Graphics g) {   
            Dimension d = getSize();     
            g.drawImage(bgImage.getImage(), 0, 0, (int)d.getWidth(), (int)d.getHeight() , this);         
        }
}
